<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAkbusMrApplyMaterialTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('akbus_mr_apply_material', function (Blueprint $table) {
            $table->id();
            $table->string('title')->nullable()->comment('材料名称');
            $table->string('unit')->nullable()->comment('单位');
            $table->decimal('price')->nullable()->comment('单价');
            $table->integer('count')->nullable()->comment('数量');
            $table->unsignedBigInteger('mr_apply_id')->comment('维修单ID');
            $table->foreign('mr_apply_id')->references('id')->on('akbus_mr_apply')->onDelete('cascade');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('akbus_mr_apply_material');
    }
}
